// Created: 09/01/2025, ChangJiang Ru
public class InnerClass {
    public static void main(String[] args) {
        Person.Dog dog = new Person.Dog();
        dog.method();

        Person p1 = new Person();
        Person.Bird bird = p1.new Bird();
        bird.eat();
        bird.show1();
    }
}

// Declaring outer class
class Person
{
    String name = "Tom";

    // Declaring the static inner class
    static class Dog
    {
        public void method()
        {
            System.out.println("Dog like the bone!");
        }
    }

    // Declaring the non-static inner class
    class Bird
    {
        String name = "Woodpecker";

        public void eat()
        {
            System.out.println("Bird like the bug!");
            System.out.println("name = " + name);
            System.out.println("name = " + this.name);
            System.out.println("name = " + Person.this.name);
        }

        public void show1()
        {
            eat();
            this.eat();
            Person.this.eat();
        }
    }

    public void eat()
    {
        System.out.println("Person like the food!");
    }
}
